package demo1;

public class Student implements Comparable<Student>{
    String name;
    int age;
    int score;

    public Student(String name, int age,int score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(Student o) {
       if(this.score > o.score){
           return 1;
       } else if (this.score == o.score) {
           return 0;
       }else{
           return -1;
       }
    }
}
